/*
* Copyright (c) 2007 by Kirill Kolodyazhniy.
* See the file "license.terms" for information on usage and redistribution.
*/

#ifndef M_OCTREERENDERABLE_H
#define M_OCTREERENDERABLE_H

#include "types.h"
#include "renderable.h"

namespace Engine
{
	/**
	*   Helper class for rendering static geometry
	*/
	class StaticGeomRenderable: public Renderable
	{
	public:
		StaticGeomRenderable(VertexDeclarationPtr vertexDeclaration, HardWareBufferPtr vertexData, MaterialPtr material,unsigned int faces, unsigned int vertices);
		~StaticGeomRenderable();
		void Lock();
		void UnLock();
		void AddIndex(const unsigned short* v, size_t len);
		virtual const MaterialPtr GetMaterial(void) const;
		virtual RenderDataPtr GetRenderData() const;
		virtual const Matrix4<REAL>& GetWorldTransform() const;
		virtual const HardWareBufferPtr GetVertexData() const;
		virtual const HardWareBufferPtr GetIndexData() const;
		virtual const VertexDeclarationPtr GetVertexDeclaration() const ;
	private:
		unsigned short* m_indexDataPtr;
		unsigned int m_index;
		Matrix4<REAL> m_transform;
		MaterialPtr m_material;
		RefPtr<RenderData, WeakPtrExtension> m_renderData;
		VertexDeclarationPtr m_vertexDeclaration;
		HardWareBufferPtr m_vertexData;
		RefPtr<HardWareBuffer,WeakPtrExtension> m_indexData;
	};

	typedef RefPtr<StaticGeomRenderable,WeakPtrExtension> StaticGeomRenderablePtr;
	typedef std::map<std::string, StaticGeomRenderablePtr> RenderablesMap;
}

#endif
